home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
054a
/
wincmd.zip
/
2CLIP.WCM
next >
Wrap
Text File
|
1993-04-07
|
1KB
|
47 lines
//-----------------------------------------------------
// 2CLIP.WCM--WinCmd program that copies a text file into
// the Windows Clipboard.
//-----------------------------------------------------
//
// Ask user for file name. Default to blank
//
ans = AskBox ("Enter the name of the file to copy into the clipboard"," ")
//
// If user pressed the Cancel button, quit
//
if ans+a == a
exit
//
// Start NotePad
//
notepad
//
// Send keys to notepad to read in the file
//
sendkeys ("%fo") //Display the file open dialog box
sendkeys (ans) //Enter file spec
sendkeys ("{enter}") //Open the file.
//
// See if notepad read the file. If it didn't, the warning box
// for the "Open" dialog will be active, and GetAppActive() will
// return "Open". In that case, close notepad and tell the user
//
winact = Getappactive()
if (winact = "Open") do
sendkeys ("{enter}") //Close the warning box
sendkeys ("{esc}") //Close the file open box
ok = fail
end
else do
sendkeys ("%ea") //Select all the text
sendkeys ("%ec") //Copy the data into the clipboard
ok = pass
end
sendkeys ("%fx") //Close notepad
if (ok = fail)
msgbox ("Notepad could not access the file you requested. Nothing was copied into the clipboard", "Error!", 0)
exit